﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>字典目录管理</title>
    <#include "../common/link.ftl">
    <script>
        $(function () {



            $('.btn-input').click(function () {

                $('#editForm')[0].reset();

                var data = $(this).data('json');
                console.log(data);

                $('.modal-title').html("字典目录添加")
                if (data) {
                    $('.modal-title').html("字典目录编辑")
                    $('input[name="id"]').val(data.id)
                    $('input[name="title"]').val(data.title)
                    $('input[name="sn"]').val(data.sn)
                    $('input[name="intro"]').val(data.intro)

                }


                $('#editModal').modal('show')
            })


            $('.btn-submit').click(function () {
                $('#editForm').ajaxSubmit(function (data) {
                    if (data.success) {
                        $.messager.confirm("温馨提示", data.msg, function () {
                            window.location.reload();
                        });
                    } else {
                        $.messager.alert("温馨提示", data.msg)
                    }
                })

                /* $.post('/systemDictionary/saveOrUpdate.do',$('#editForm').serialize(),function (data) {

                 })*/
            })

          /*  //删除
            $('.btn-delete').click(function () {
                var data = $(this).data('json');
                $.messager.confirm('温馨提示', '你确定要删除吗?', function () {

                    $.post('/systemDictionary/delete.do', {id: data.id}, function (data) {
                        if (data.success) {
                            $.messager.confirm("温馨提示", data.msg, function () {
                                window.location.reload();
                            });
                        } else {
                            $.messager.alert("温馨提示", data.msg)
                        }
                    })
                })
            })*/
        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="systemDictionary">
    <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>字典目录管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/systemDictionary/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <a class="btn btn-success btn-input " style="margin: 10px">
                        <span class="glyphicon glyphicon-plus "></span> 添加
                    </a>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>字典目录名称</th>
                            <th>字典目录编号</th>
                            <th>字典目录描述</th>
                            <th>操作</th>
                        </tr>


                        <#list pageInfo.list as systemDictionary>
                            <tr>
                                <td>${systemDictionary_index+1}</td>
                                <td>${systemDictionary.title}</td>
                                <td>${systemDictionary.sn}</td>
                                <td>${systemDictionary.intro}</td>
                                <td>
                                    <a data-json='${systemDictionary.jsonData}' class="btn btn-info btn-xs btn-input">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                    <a data-id='${systemDictionary.id}' data-url="/systemDictionary/delete.do"
                                       class="btn btn-danger btn-xs btn-delete">
                                        <span class="glyphicon glyphicon-trash"></span> 删除
                                    </a>
                                </td>
                            </tr>
                        </#list>

                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>
<!---字典目录编辑--->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">字典目录添加</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/systemDictionary/saveOrUpdate.do" method="post" id="editForm">
                    <input type="hidden" value="" name="id">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">字典目录名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title" value="" placeholder="请输入字典目录名称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">字典目录编号：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="sn" value="" placeholder="请输入字典目录编号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">字典目录描述：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="intro" value="" placeholder="请输入字典目录描述">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btn-submit">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
